﻿@inherits BaseComponent

@if (Context.IsEditTable && Model?.Table?.EnableEdit == true)
{
    <div class="kui-edit" style="margin-right:10px;" @onclick="OnEditTool">
        <KIcon Icon="edit" Title="@Language.EditToolbar" />
    </div>
}
@if (Model != null && (Model.Left != null || Model.Right != null || Model.HasItem))
{
    var items = Model.Items.GetGroupItems();
    <div class="ant-toolbar">
        @Model.Left
        @if (Model.HasItem)
        {
            if (items.Count > Model.ShowCount)
            {
                for (int i = 0; i < Model.ShowCount - 1; i++)
                {
                    var item = items[i];
                    <KAction ShowIcon Item="item" OnItemClick="Model.OnItemClick" />
                }
                var more = GetDropdownModel(Language.More);
                more.Items = items.Skip(Model.ShowCount - 1).ToList();
                <AntDropdown Context="Context" Model="more" />
            }
            else
            {
                foreach (var item in items)
                {
                    <KAction ShowIcon Item="item" OnItemClick="Model.OnItemClick" />
                }
            }
        }
        @Model.Right
    </div>
}